/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Minh Luc
 */
@Entity
@Table(name = "Hospital", catalog = "P2PDB", schema = "dbo", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"HospitalName"}),
    @UniqueConstraint(columnNames = {"OfficePhone"})})
@NamedQueries({
    @NamedQuery(name = "Hospital.findAll", query = "SELECT h FROM Hospital h"),
    @NamedQuery(name = "Hospital.findByHospitalId", query = "SELECT h FROM Hospital h WHERE h.hospitalId = :hospitalId"),
    @NamedQuery(name = "Hospital.findByHospitalName", query = "SELECT h FROM Hospital h WHERE h.hospitalName = :hospitalName"),
    @NamedQuery(name = "Hospital.findByAddress", query = "SELECT h FROM Hospital h WHERE h.address = :address"),
    @NamedQuery(name = "Hospital.findByCity", query = "SELECT h FROM Hospital h WHERE h.city = :city"),
    @NamedQuery(name = "Hospital.findByRegion", query = "SELECT h FROM Hospital h WHERE h.region = :region"),
    @NamedQuery(name = "Hospital.findByPostalCode", query = "SELECT h FROM Hospital h WHERE h.postalCode = :postalCode"),
    @NamedQuery(name = "Hospital.findByOfficePhone", query = "SELECT h FROM Hospital h WHERE h.officePhone = :officePhone"),
    @NamedQuery(name = "Hospital.findByIsLock", query = "SELECT h FROM Hospital h WHERE h.isLock = :isLock")})
public class Hospital implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "HospitalId", nullable = false)
    private Integer hospitalId;
    @Column(name = "HospitalName", length = 100)
    private String hospitalName;
    @Column(name = "Address", length = 2147483647)
    private String address;
    @Column(name = "City", length = 50)
    private String city;
    @Column(name = "Region", length = 50)
    private String region;
    @Column(name = "PostalCode", length = 10)
    private String postalCode;
    @Column(name = "OfficePhone", length = 20)
    private String officePhone;
    @Column(name = "isLock")
    private Boolean isLock;
    @OneToMany(mappedBy = "hospital")
    private Collection<Payment> paymentCollection;

    public Hospital() {
    }

    public Hospital(Integer hospitalId) {
        this.hospitalId = hospitalId;
    }

    public Integer getHospitalId() {
        return hospitalId;
    }

    public void setHospitalId(Integer hospitalId) {
        this.hospitalId = hospitalId;
    }

    public String getHospitalName() {
        return hospitalName;
    }

    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getPostalCode() {
        return postalCode;
    }

    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    public String getOfficePhone() {
        return officePhone;
    }

    public void setOfficePhone(String officePhone) {
        this.officePhone = officePhone;
    }

    public Boolean getIsLock() {
        return isLock;
    }

    public void setIsLock(Boolean isLock) {
        this.isLock = isLock;
    }

    public Collection<Payment> getPaymentCollection() {
        return paymentCollection;
    }

    public void setPaymentCollection(Collection<Payment> paymentCollection) {
        this.paymentCollection = paymentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (hospitalId != null ? hospitalId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Hospital)) {
            return false;
        }
        Hospital other = (Hospital) object;
        if ((this.hospitalId == null && other.hospitalId != null) || (this.hospitalId != null && !this.hospitalId.equals(other.hospitalId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Hospital[hospitalId=" + hospitalId + "]";
    }

}
